package main.model;

import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Properties;

public class Settings {

	private Properties prop;
	private final String CONFIG_PATH = "config/standard.config";
	public Settings() {
		prop = new Properties();
		try {
			prop.load(new InputStreamReader(new FileInputStream(CONFIG_PATH), "UTF-8"));
		} catch (Exception e) {
			System.err.println("Problem when loading config");
			e.printStackTrace();
		}
	}
	
	public boolean logToFile() {
		String config = prop.getProperty("logtofile", "yes");
		return config.equals("yes");
	}
	
	public boolean clickToClick() {
		String config = prop.getProperty("clicktoclick", "yes");
		return config.equals("yes");
	}
	
	public boolean enterToClick() {
		String config = prop.getProperty("entertoclick", "yes");
		return config.equals("yes");
	}
	
	public boolean moveMouse() {
		String config = prop.getProperty("movemouse", "yes");
		return config.equals("yes");
	}
	
	public boolean showMouse() {
		String config = prop.getProperty("showmouse", "no");
		return config.equals("yes");
	}
	
	public String configKeyboard() {
		return prop.getProperty("keyboard","keyboard");
	}
	
	public int keySize() {
		String data = prop.getProperty("keySize","40");
		try {
			return Integer.parseInt(data);
		} catch (NumberFormatException e) {
			System.err.println("Illegal signs in keySize property. Returning standard value (40)");
			e.printStackTrace();
			return 40;
		}
	}

	public String keyboardPassword() {
		return prop.getProperty("keyHeaderPassword","Password");
	}

	public String keyboardText() {
		return prop.getProperty("keyHeaderText","Username");
	}
}
